//@ts-ignore
import request from '@/utils/http.ts'
import type { CategoryData, CategoryListData } from './type.ts'
enum API {
  CATEGORY1_API = '/admin/product/getCategory1',
  CATEGORY2_API = '/admin/product/getCategory2/',
  CATEGORY3_API = '/admin/product/getCategory3/',
  GATEGORYGET_API = '/admin/product/attrInfoList/',
  ADDORUPDATEATTR_URL = '/admin/product/saveAttrInfo',
  DELETEATTR_URL = '/admin/product/deleteAttr/',
}

export const reqGategpry1 = () => {
  return request<any, CategoryData>({
    url: API.CATEGORY1_API,
  })
}
export const reqGategpry2 = (id: number) => {
  return request<any, CategoryData>({
    url: API.CATEGORY2_API + id,
  })
}
export const reqGategpry3 = (id: number) => {
  return request<any, CategoryData>({
    url: API.CATEGORY3_API + id,
  })
}
export const reqGetGategpry = (id1: number, id2: number, id3: number) => {
  return request<any, CategoryListData>({
    url: API.GATEGORYGET_API + `${id1}/${id2}/${id3}`,
  })
}
export const reqAddOrupdateattr = (data: any) => {
  return request<any, any>({
    url: API.ADDORUPDATEATTR_URL,
    method: 'post',
    data,
  })
}
export const reqDelattr = (id: number) => {
  return request<any, any>({
    url: API.DELETEATTR_URL + id,
    method: 'delete',
  })
}
